package com.leather.quan.controller;

import com.leather.common.result.Result;
import com.leather.quan.service.CommentService;
import com.leather.quan.vo.CommentAddVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CommentController {

    @Autowired
    private CommentService commentService;


    @PostMapping("addcoment")
    public Result addComment(CommentAddVo commentAddVo){
        return commentService.addComment(commentAddVo);
    }

    @GetMapping("getcomment")
    public Result getComment(int quanId){
        return commentService.queryCommentByQuanId(quanId);
    }

    @PostMapping("deletecomment")
    public Result deleteComment(int id,int userId) {
        return commentService.deleteByUserId(id,userId);
    }

}
